// var areaData = address;
var $form;
var form;
var $;
layui.config({
	base : "../../js/"
}).use(['form','layer','upload','laydate'],function(){
	form = layui.form();
	var layer = parent.layer === undefined ? layui.layer : parent.layer;
		$ = layui.jquery;
		$form = $('form');
		laydate = layui.laydate;
        layui.upload({
        	url : "userface.json",
            ext: 'jpg|png|gif',
        	success: function(res){     
        		// var num = parseInt(4*Math.random());  //生成0-4的随机数
        		//随机显示一个头像信息
		    	// userFace.src = res.data[num].src;
		    	// window.sessionStorage.setItem('userFace',res.data[num].src);
                alert(11)
                console.log(res)
		    }
        });
       

        //判断是否修改过头像，如果修改过则显示修改后的头像，否则显示默认头像
        if(window.sessionStorage.getItem('userFace')){
        	$("#userFace").attr("src",window.sessionStorage.getItem('userFace'));
        }else{
        	$("#userFace").attr("src","/pc/private/img/face.jpg");
        }

        //提交个人资料
        form.on("submit(changeUser)",function(data){
        	var index = layer.msg('提交中，请稍候',{icon: 16,time:false,shade:0.8});
            setTimeout(function(){
                layer.close(index);
                layer.msg("提交成功！");
            },2000);
        	return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        })

        


})

 